package com.theo.mapper;

import com.theo.entity.PatientInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 方涛
 * @since 2021-02-02
 */
@Repository
public interface PatientInfoMapper extends BaseMapper<PatientInfo> {

    int savePatientInfo(PatientInfo patientInfo);

    int deletePatientInfo(Integer id);

    int updatePatientInfo(Integer id);

    @Select("SELECT p.patient_name,p.patient_id,p.city_id,c.city_name,p.location,p.decription\n" +
            "FROM patient_info p INNER JOIN city_info c\n" +
            "ON p.city_id = c.city_id")
    List<PatientInfo> queryAllPatientInfo();

    PatientInfo queryPatientInfoById(Integer id);
}
